﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yasbg
{
    class Program
    {
        static int Main(string[] args)
        {
            File generator = new File();
            if (args.Length == 0)
            {
                errorArg("<command> <parameters>");
               

            }
            else if (args[0] == "all")
                generator.UpdateAll();
            else if (args[0] == "file")
            {
                if (args[0].Length == 0)
                    errorArg("file <file.extension>");
                else
                    generator.New(string.Format(args[1]));

            }
            else if (args[0] == "debug")
            {
                generator.ifdebugfile = true;
                generator.UpdateAll();
            }
            else
                errorArg("<command> <parameters>");
            
            return 0;
        }
        static public void errorArg(string parameters)
        {
              
            Console.WriteLine("Syntax error. ");
            Console.WriteLine("Usage: yasbg " + parameters);
            
            Environment.Exit(0);

            
        }
        static public void errorArg(string parameters, string exception, bool ifdebug)
        {
            if (ifdebug)
            {
                Console.WriteLine("Error: " + parameters);
                Console.WriteLine("Debug info:" + exception);
            }
            else
                Console.WriteLine("Error: " + parameters);
            
            Environment.Exit(0);

        }
      
    }
}
